﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PatternProxy
{
    class Program
    {
        static void Main(string[] args)
        {

            new RealSubjectProxy(new RealSubject()).doWork(); 

        }
    }


    interface ISubject
    {
        void doWork();
    }

    class RealSubject : ISubject
    {
        public void doWork()
        {
            Console.WriteLine("Show Pics"); ;
        }
    }


    class RealSubjectProxy : ISubject
    {
        RealSubject realSubject;
        public RealSubjectProxy(RealSubject _realSubject)
        {
            this.realSubject = _realSubject;
        }
        

        public void Connect()
        {
            Console.WriteLine("connect");
        }
        public void Log()
        {
            Console.WriteLine("Log");
        }
         
        public void doWork()
        {
            Connect();
            realSubject.doWork();
            Log();
        }
    }
}
